﻿
Imports centrosphere
Imports command = centrosphere.job.simple.command

Public Class simpleJobConsumer
    Inherits jobConsumer(Of simpleJob)

    Protected Overrides Function workOn(ByVal j As simpleJob, Optional ByRef ec As eventComb = Nothing) As Boolean
        assert(Not j Is Nothing)
        Select Case j.cmd.as(Of Byte).as(Of command)()
            Case command.increment
                j.i64 = New bytesInt64(unsafe_increase(j.i64.as(Of Int64)()))
            Case command.decrement
                j.i64 = New bytesInt64(unsafe_increase(j.i64.as(Of Int64)(), -1))
            Case Else
                raiseError(errorHandle.errorType.warning, "unknown command ", j.cmd, " got, ignore")
                Return False
        End Select

        Return True
    End Function
End Class
